<?php
/**
 * @var $jobsList
 * @var $provinceList
 * @var $cateId
 * @var $page
 * @var $currentProvince
 * @var $cityId
 */
$currentProvinceName = $this->request->getParam('provinceName',false);
$currentCityName = $this->request->getParam('cityName',false);
?>
<div class="mainJobs mainWith">
    <div class="breadCrumb">
        当前位置：<a href="/">首页</a> >
        <a href="/jobs">招聘信息</a> >
        <?php if($cityId){
           ?>
            <span><?php echo $currentProvince->first()->name?>(<?php echo $cityId->first()->name?>)<?php echo $cateId->first()->name?>教师招聘</span>
        <?php
        } else {
            ?>
            <span><?php echo $currentProvince->first()->name?><?php echo $cateId->first()->name?>教师招聘</span>
        <?php
        }?>
    </div>
    <div class="schoolLocationListWrap clearFix">
        <div class="locationLabel">
            地区
        </div>
        <div class="province">
            <a href="/jobs">全国</a>
            <?php if($currentCityName){
                ?>
                <a href="/jobs/<?php echo explode('/',$this->request->url)[1]?>/<?php echo $currentProvince->first()->name_py?>"><?php echo $currentProvince->first()->name?></a>
            <?php
            } else {
                ?>
                <a href="javascript:void(0)" class="selectLocation"><?php echo $currentProvince->first()->name?></a>
            <?php
            }?>
            <?php foreach ($provinceList as $item){
                ?>
                <a href="/jobs/<?php echo explode('/',$this->request->url)[1]?>/<?php echo $currentProvince->first()->name_py?>/<?php echo $item->name_py?>" class="<?php echo $currentCityName === $item->name_py?'selectLocation':''?>"><?php echo $item->name?></a>
                <?php
            }?>
        </div>
    </div>
    <div class="jobsList">
        <div class="jobsListHeader clearFix">
            工作列表
        </div>
        <div class="jobsListContent">
            <?php foreach ($jobsList as $item){
                ?>
                <div class="jobsListDetail clearFix">
                    <div class="jobsListDetailLeft">
                        <div class="jobsListDetailHeader clearFix">
                            <div class="jobsListDetailHeaderLeft">
                                <a href="/jobs/<?php echo $item->category->name_py?>/<?php echo $item->id?>.html" title="<?php echo $item->name?>"><?php echo $item->name?></a>
                            </div>
                            <div class="jobsListDetailHeaderRight">
                                <a href="/school/<?php echo $item->school->id?>.html" title="<?php echo $item->school->title?>"><?php echo $item->school->title?></a>
                            </div>
                        </div>
                        <div class="jobsListDetailContent">
                            <p>学历要求：<?php echo $item->education?>&nbsp;&nbsp;|&nbsp;&nbsp;工作经验：<?php echo $item->job_experience?>&nbsp;&nbsp;|&nbsp;&nbsp;工作地点：<?php echo $item->school->location?>&nbsp;&nbsp;|&nbsp;&nbsp;招聘人数：<?php echo $item->need_num?>&nbsp;&nbsp;|&nbsp;&nbsp;薪资待遇：<?php echo $item->salary?>&nbsp;&nbsp;|&nbsp;&nbsp;<span class="publishTime"><?php echo $item->publish_date?></span>发布</p>
                            <div class="shortIntro">
                                <?php echo $item->job_intro?>
                            </div>
                        </div>
                    </div>
                    <div class="jobsListDetailRight">
                    <span class="collect">
                        <i class="fa fa-star-o" aria-hidden="true"></i>
                    </span>
                        收藏
                    </div>
                </div>
                <?php
            }?>
            <?php if($jobsList->count() === 0){
                ?>
                <p style="font-size: 18px;text-align: center;margin: 30px 0 0 0;">暂无数据</p>
            <?php
            }?>
            <div class="page-wrapper">
                <!--分页代码-->
                <?php
                    if($currentCityName){
                        $url = '/jobs/'.explode('/',$this->request->url)[1].'/'.$currentProvinceName.'/'.$currentCityName.'/p';
                    } else {
                        $url = '/jobs/'.explode('/',$this->request->url)[1].'/'.$currentProvinceName.'/p';
                    }
                    echo $this->element('paginator', [  "url" => $url ]);
                ?>
            </div>
        </div>
    </div>
</div>